package com.hbx.constant;

import lombok.Getter;
import lombok.Setter;

/*
 * @Author:hbx
 * 
 * */
public enum OperaResultEnum {

    OPERA_SUCCESS("success","成功"),
    OPERA_ERROR("error","失败"),
    OPERA_EXCEPTION("exception","异常")
    ;

    @Setter
    @Getter
    private String result;

    @Setter
    @Getter
    private String desc;

    OperaResultEnum(String result,String desc){
        this.result = result;
        this.desc = desc;
    }

    public static String getOperaResult(String code){
        OperaResultEnum[] resultEnums = OperaResultEnum.values();
        for (OperaResultEnum resultEnum : resultEnums) {
            if (resultEnum.getResult().equals(code)){
                return resultEnum.getDesc();
            }
        }
        return null;
    }
}
